package com.springboot.demo.service;

import com.springboot.demo.dataobject.es.EsBlog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.elasticsearch.core.ElasticsearchTemplate;
import org.springframework.stereotype.Service;

/**
 * @author 辜圆圆
 * @description: gzy的项目
 * @date 2020/4/29 1:32 上午
 */
@Service
public class EsService {
    @Autowired
    private ElasticsearchTemplate esTemplate;

    /**
     * 创建索引
     */
    public void add(){
        esTemplate.createIndex(EsBlog.class);
    }
}
